<% unless @categories == nil or @categories.first == nil %>
  <table>
    <tr>
      <td>
        <% form_remote_tag :url => {:action => 'category_select'} do %>
          <%= hidden_field_tag "master",@categories_master %>
          <%= select("category", "id", @categories.collect {|p| [ p.name, p.id ] }, { :include_blank => "Välj kategori" }, :onChange=>"this.form.onsubmit();") %>
        <% end %>
      </td>
      <td>
        <div id="category_select_<%= @categories_master %>_inner">
          <% form_remote_tag :url => { :action => 'category_save', :id => @categories_master } do %>
            <%= submit_tag 'Lägg till' %>
          <% end %>
        </div>
      </td>
    </tr>
  </table>
<% else %>
  <% form_remote_tag :url => { :action => 'category_save', :id => @categories_master } do %>
    <%= submit_tag 'Lägg till' %>
  <% end %>
<% end %>